home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / JAVA Utilities / JProxy 1.1.0 / SAMPLES.JAR / com / jproxy / samples / rmi / test / TestClient.java < prev    next >
Encoding:
Java Source  |  2003-04-29  |  841 b   |  36 lines

  1. package com.jproxy.samples.rmi.test;
  2.  
  3. import javax.naming.*;
  4. import java.rmi.*;
  5. import java.util.*;
  6.  
  7. import com.jproxy.samples.interfaces.ITest;
  8.  
  9. public class TestClient
  10. {
  11.     public static void main(String[] args)
  12.     {
  13. //        System.setSecurityManager(new RMISecurityManager());
  14. //        Hashtable env = new Hashtable();
  15. //        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.jproxy.proxy.NamingContextFactory");
  16. //        env.put(Context.PROVIDER_URL, "localhost");
  17.         try {
  18.  
  19.             InitialContext context = new InitialContext();
  20.             ITest test = (ITest) context.lookup("test");
  21.  
  22.             System.out.println(
  23.                 "\r\n**********************************"+
  24.                 "\r\nRMI Test CLIENT"+
  25.                 "\r\nServer Time: "+(new Date(test.getServerTime()))+
  26.                 "\r\n**********************************\r\n");
  27.  
  28.             context.close();
  29.         }
  30.         catch (Exception e)
  31.         {
  32.             e.printStackTrace();
  33.         }
  34.     }
  35. }
  36.